home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 104 / MacAddict_104_2005-04.iso / Software / Internet & Communication / WordPress 1.2.2 freeware.dmg / wordpress / wp-includes / template-functions-geo.php < prev    next >
Encoding:
PHP Script  |  2004-04-28  |  5.6 KB  |  156 lines

  1. <?php
  2.  
  3. function get_Lat() {
  4.     global $post;
  5.  
  6.    if ($post->post_lat != '') {
  7.        return trim($post->post_lat);
  8.    } else if(get_settings('use_default_geourl')) {
  9.        return trim(get_settings('default_geourl_lat'));
  10.    }
  11.  
  12.    return '';
  13. }
  14.  
  15. function get_Lon() {
  16.     global $post;
  17.  
  18.    if ($post->post_lon != '') {
  19.        return trim($post->post_lon);
  20.    } else if(get_settings('use_default_geourl')) {
  21.        return trim(get_settings('default_geourl_lon'));
  22.    }
  23.  
  24.    return '';
  25. }
  26.  
  27. function print_Lat() {
  28.     if(get_settings('use_geo_positions')) {
  29.         if(get_Lat() > 0) {
  30.             echo "".get_Lat()."N";
  31.         } else {
  32.             echo "".get_Lat()."S";
  33.         }
  34.     }
  35. }
  36.  
  37. function print_Lon() {
  38.     global $id, $postdata;
  39.     if(get_settings('use_geo_positions')) {
  40.         if(get_Lon() < 0) {
  41.             $temp = get_Lon() * -1;
  42.             echo "".$temp."W";
  43.         } else {
  44.             echo "".get_Lon()."E";
  45.         }
  46.     }
  47. }
  48.  
  49. function print_PopUpScript() {
  50.     echo "
  51. <script type='text/javascript'>
  52. <!-- This script and many more are available free online at -->
  53. <!-- The JavaScript Source!!  -->
  54. function formHandler(form) {
  55.   var URL = form.site.options[form.site.selectedIndex].value;
  56.   if(URL != \".\") {
  57.     popup = window.open(URL,\"MenuPopup\");
  58.   }
  59. }
  60. </script> ";
  61. }
  62.  
  63. function print_UrlPopNav() {
  64.     $sites = array(
  65.                    array('http://www.acme.com/mapper/?lat='.get_Lat().'&long='.get_Lon().'&scale=11&theme=Image&width=3&height=2&dot=Yes',
  66.                          __('Acme Mapper')),
  67.                    array('http://geourl.org/near/?lat='.get_Lat().'&lon='.get_Lon().'&dist=500',
  68.                          __('GeoURLs near here')),
  69.                    array('http://www.geocaching.com/seek/nearest.aspx?origin_lat='.get_Lat().'&origin_long='.get_Lon().'&dist=5',
  70.                          __('Geocaches near here')),
  71.                    array('http://www.mapquest.com/maps/map.adp?latlongtype=decimal&latitude='.get_Lat().'&longitude='.get_Lon(),
  72.                          __('Mapquest map of this spot')),
  73.                    array('http://www.sidebit.com/ProjectGeoURLMap.php?lat='.get_Lat().'&lon='.get_Lon(),
  74.                          __('SideBit URL Map of this spot')),
  75.                    array('http://confluence.org/confluence.php?lat='.get_Lat().'&lon='.get_Lon(),
  76.                          __('Confluence.org near here')),
  77.                    array('http://www.topozone.com/map.asp?lat='.get_Lat().'&lon='.get_Lon(),
  78.                          __('Topozone near here')),
  79.                    array('http://www.findu.com/cgi-bin/near.cgi?lat='.get_Lat().'&lon='.get_Lon(),
  80.                          __('FindU near here')),
  81.                    array('http://mapserver.maptech.com/api/espn/index.cfm?lat='.get_Lat().'&lon='.get_Lon().'&scale=100000&zoom=50&type=1&icon=0&&scriptfile=http://mapserver.maptech.com/api/espn/index.cfm',
  82.                          __('Maptech near here'))
  83.                   );
  84.     echo '<form action=""><div>
  85. <select name="site" size="1" onchange="formHandler(this.form);" >'."\n";
  86.     echo '<option value=".">' . sprintf(__("Sites referencing %s x %s"), get_Lat(), get_Lon()) . "</option>\n";
  87.     foreach($sites as $site) {
  88.         echo "\t".'<option value="'.$site[0].'">'.$site[1]."</option>\n";
  89.     }
  90.     echo '</select></div>
  91. </form>'."\n";
  92. }
  93.  
  94. function longitude_invalid() {
  95.     if (get_Lon() == null) return true;
  96.     if (get_Lon() > 360) return true;
  97.     if (get_Lon() < -360) return true;
  98. }
  99.  
  100. function print_AcmeMap_Url() {
  101.     if (!get_settings('use_geo_positions')) return;
  102.     if (longitude_invalid()) return;
  103.     echo "http://www.acme.com/mapper?lat=".get_Lat()."&long=".get_Lon()."&scale=11&theme=Image&width=3&height=2&dot=Yes";
  104. }
  105.  
  106. function print_GeoURL_Url() {
  107.     if (!get_settings('use_geo_positions')) return;
  108.     if (longitude_invalid()) return;
  109.     echo "http://geourl.org/near/?lat=".get_Lat()."&lon=".get_Lon()."&dist=500";
  110. }
  111.  
  112. function print_GeoCache_Url() {
  113.     if (!get_settings('use_geo_positions')) return;
  114.     if (longitude_invalid()) return;
  115.     echo "http://www.geocaching.com/seek/nearest.aspx?origin_lat=".get_Lat()."&origin_long=".get_Lon()."&dist=5";
  116. }
  117.  
  118. function print_MapQuest_Url() {
  119.     if (!get_settings('use_geo_positions')) return;
  120.  
  121.     if (longitude_invalid()) return;
  122.     echo "http://www.mapquest.com/maps/map.adp?latlongtype=decimal&latitude=".get_Lat()."&longitude=".get_Lon();
  123. }
  124.  
  125. function print_SideBit_Url() {
  126.     if (!get_settings('use_geo_positions')) return;
  127.     if (longitude_invalid()) return;
  128.     echo "http://www.sidebit.com/ProjectGeoURLMap.php?lat=".get_Lat()."&lon=".get_Lon();
  129. }
  130.  
  131. function print_DegreeConfluence_Url() {
  132.     if (!get_settings('use_geo_positions')) return;
  133.     if (longitude_invalid()) return;
  134.     echo "http://confluence.org/confluence.php?lat=".get_Lat()."&lon=".get_Lon();
  135. }
  136.  
  137. function print_TopoZone_Url() {
  138.     if (!get_settings('use_geo_positions')) return;
  139.     if (longitude_invalid()) return;
  140.     echo "http://www.topozone.com/map.asp?lat=".get_Lat()."&lon=".get_Lon();
  141. }
  142.  
  143. function print_FindU_Url() {
  144.     if (!get_settings('use_geo_positions')) return;
  145.     if (longitude_invalid()) return;
  146.     echo "http://www.findu.com/cgi-bin/near.cgi?lat=".get_Lat()."&lon=".get_Lon()."&scale=100000&zoom=50&type=1&icon=0&&scriptfile=http://mapserver.maptech.com/api/espn/index.cfm";
  147. }
  148.  
  149. function print_MapTech_Url() {
  150.     if (!get_settings('use_geo_positions')) return;
  151.     if (longitude_invalid()) return;
  152.     echo "http://mapserver.maptech.com/api/espn/index.cfm?lat=".get_Lat()."&lon=".get_Lon();
  153. }
  154.  
  155. ?>
  156.